package com.GB26875_3_2011.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 蒋仕国
 * @projectName GB26875_3_211
 * @ClassName DataUnitType
 * @date 2025-01-13 16:11
 * @Description: TODO []
 */

@Getter
@AllArgsConstructor
public enum DataUnitType {
    MESSAGE_0(0,"预留",MessageDirection.UNKNOWN),
    MESSAGE_1(1,"上传建筑消防设施系统状态",MessageDirection.UP),
    MESSAGE_2(2,"上传建筑消防设施部件运行状态",MessageDirection.UP),
    MESSAGE_3(3, "上传建筑消防设施部件模拟量值", MessageDirection.UP),
    MESSAGE_4(4, "上传建筑消防设施操作信息",MessageDirection.UP),
    MESSAGE_5(5, "上传建筑消防设施软件版本",MessageDirection.UP),
    MESSAGE_6(6, "上传建筑消防设施系统配置情况",MessageDirection.UP),
    MESSAGE_7(7, "上传建筑消防设施部件配置情况",MessageDirection.UP),
    MESSAGE_8(8, "上传建筑消防设施系统时间",MessageDirection.UP),
    MESSAGE_9_20(9, "预留（建筑小法设施信息）",MessageDirection.UP),
    MESSAGE_21(21, "上传用户信息传输装置运行状态", MessageDirection.UP),
    MESSAGE_22(22, "预留", MessageDirection.UP),
    MESSAGE_23(23, "预留", MessageDirection.UP),
    MESSAGE_24(24, "上传用户信息传输装置操作信息",MessageDirection.UP),
    MESSAGE_25(25, "上传用户信息传输装置软件版本",MessageDirection.UP),
    MESSAGE_26(26, "上传用户信息传输装置配置情况",MessageDirection.UP),
    MESSAGE_27(27, "预留",MessageDirection.UP),
    MESSAGE_28(28, "上传用户信息传输装置系统时间",MessageDirection.UP),
    MESSAGE_29_40(29,"预留（用户信息传输装置信息）",MessageDirection.UP),
    MESSAGE_41_60(41,"预留（控制信息）",MessageDirection.UP),
    MESSAGE_61(61,"读建筑消防设施系统状态",MessageDirection.DOWN),
    MESSAGE_62(62,"读建筑消防设施部件运行状态",MessageDirection.DOWN),
    MESSAGE_63(63,"读建筑消防设施部件模拟量值",MessageDirection.DOWN),
    MESSAGE_64(64,"读建筑消防设施操作信息",MessageDirection.DOWN),
    MESSAGE_65(65,"读建筑消防设施软件版本",MessageDirection.DOWN),
    MESSAGE_66(66,"读建筑消防设施系统配置情况",MessageDirection.DOWN),
    MESSAGE_67(67,"读建筑消防设施部件配置情况",MessageDirection.DOWN),
    MESSAGE_68(68,"读建筑消防设施系统时间",MessageDirection.DOWN),
    MESSAGE_69_80(69,"预留（建筑小法设施信息）",MessageDirection.DOWN),
    MESSAGE_81(81,"读用户信息传输装置运行状态",MessageDirection.DOWN),
    MESSAGE_82(82,"预留",MessageDirection.DOWN),
    MESSAGE_83(83,"预留",MessageDirection.DOWN),
    MESSAGE_84(84,"读用户信息传输装置操作信息记录",MessageDirection.DOWN),
    MESSAGE_85(85,"读用户信息传输装置软件版本",MessageDirection.DOWN),
    MESSAGE_86(86,"读用户信息传输装置配置情况",MessageDirection.DOWN),
    MESSAGE_87(87,"预留",MessageDirection.DOWN),
    MESSAGE_88(88,"读用户信息传输装置系统时间",MessageDirection.DOWN),
    MESSAGE_89(89,"初始化用户信息传输装置",MessageDirection.DOWN),
    MESSAGE_90(90,"同步用户信息传输装置时钟",MessageDirection.DOWN),
    MESSAGE_91(91,"查岗命令",MessageDirection.DOWN),
    MESSAGE_92_127(92,"预留",MessageDirection.DOWN),
    MESSAGE_128_254(128,"预留",MessageDirection.DOWN)
    ;
    // 消息编码
    private final int code;
    // 消息名称
    private final String name;
    // 消息方向
    private final MessageDirection direction;

    public static DataUnitType getByCode(int code) {
        for (DataUnitType dataUnitType : values()) {
            if (dataUnitType.getCode() == code) {
                return dataUnitType;
            }
        }
        return MESSAGE_0;
    }
}



enum MessageDirection {
    /**
     * 上行
     */
    UP,
    /**
     * 下行
     */
    DOWN,
    /**
     * 双向
     */
    BOTH,
    /**
     * 未知
     */
    UNKNOWN
}
